﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using DataLib.Accounts.Bus;

namespace DataLib.Accounts
{
    public partial class RoleAdmin : System.Web.UI.Page
    {

        private DataSet roles;

        protected void Page_Load(object sender, EventArgs e)
        {
            dataBind();
        }

        private void dataBind()
        {
            roles = AccountsTool.GetRoleList();
            RoleList.DataSource = roles.Tables["Roles"];
            RoleList.DataBind();
        }

        protected void BtnAdd_Click(object sender, EventArgs e)
        {
            Role role = new Role();
            role.Description = TextBox1.Text;
            try
            {
                role.Create();
            }
            catch { }
            TextBox1.Text = "";
            dataBind();

        }

    }
}